﻿using System;
using Ah.Testudin.Engine.Events;
using Microsoft.Xna.Framework;

namespace Ah.Testudin.Engine.Actors.Components
{
    public class TransformComponent : IActorComponent
    {
        #region Private Member Variables

        private Matrix _transform;

        #endregion

        #region Properties

        public Matrix Transform 
        { 
            get
            {
                return _transform;
            }

            set
            {
                _transform = value;
            }
        }

        public Vector3 Postition
        {
            get
            {
                return _transform.Translation;
            }

            set
            {
                _transform.Translation = value;
            }
        }

        public Vector3 LookAt
        {
            get
            {
                return _transform.Forward;
            }

            set
            {
                _transform.Forward = value;
            }
        }

        #endregion

        #region Constructors

        public TransformComponent(
            Actor owner,
            Matrix transform)
        {
            if (owner == null)
            {
                throw new ArgumentNullException("owner");
            }

            this.Owner = owner;

            _transform = transform;
        }

        #endregion

        #region IActorComponent

        public Actor Owner { get; private set; }

        public void Update(GameTime gameTime)
        {
            // I don't update
        }

        public void Dispose()
        {
        }

        #endregion
    }
}
